package com.example.tests;

import com.example.GeneralMetods;
import com.example.SortedListOf;
import com.example.User;
import com.example.pages.UserManagementPage;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class DeleteUser extends GeneralMetods {

    @Test
    public void testAddUser() throws Exception {
        UserManagementPage usersPage = goToMainPage()
                .loginAs("admin", "admin")
                .goToUserManagementPage();
        SortedListOf<User> oldUsersList = usersPage.getUsers();
        usersPage.deleteFirstUser();

        if (usersPage.deletedUser != null) {
            SortedListOf<User> newUsersList = usersPage.getUsers();
            assertEquals(oldUsersList.without(usersPage.deletedUser), newUsersList);
        }

        usersPage.logout();

    }
}
